from fastapi import FastAPI
import uvicorn
from datetime import datetime
from db import MyData
from pydantic import BaseModel


class Item(BaseModel):
    title: str
    amount: float
    time: datetime    


app = FastAPI()

@app.get("/")
def root():
    return {"Hello": "World"}

@app.post("/money/add")
def add(item: Item):
    d = MyData()
    d.add(item.title, item.amount, item.time) 


if __name__ == "__main__":
    uvicorn.run(app, host="127.0.0.1", port=5000, log_level="info")